﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace English_v2
{
    public partial class EndDialogForm : Form
    {
        private string miniAppMode = null;

        public string MiniAppMode
        {
            get
            {
                return this.miniAppMode;
            }
            set
            {
                this.miniAppMode = value;
            }
        }
        
        public EndDialogForm()
        {
            InitializeComponent();
        }

        private void EndDialogForm_Load(object sender, EventArgs e)
        {
            switch (this.miniAppMode)
            {
                case "sentenceForm":
                    this.fromSenOrForm();
                    break;
                case "wordsForm":
                    this.fromWordsForm();
                    break;
                default:
                    this.DialogResult = DialogResult.Abort;
                    this.Visible = false;
                    MessageBox.Show("END !");
                    this.Close();
                    break;
            }
        }

        private void fromSenOrForm()
        {
            congratLabel.Text += " succesfully ordered all sentences.\nPlease select one of the following options.";
            RadioButton modeButton = new RadioButton();
            modeButton.AutoSize = true;
            modeButton.Parent = this.groupBox;
            modeButton.Left = 6;
            modeButton.Top = 82;
            modeButton.Name = "modeButton";
            modeButton.Text = "Change mode";
            modeButton.Click += new EventHandler(this.selectedButton);
            this.groupBox.Left = 136;
            this.groupBox.Top = 6;
        }

        private void fromWordsForm()
        {
            congratLabel.Text += " correctly filled all articles.\nPlease select one of the following options.";
        }

        private void selectedButton(object sender, EventArgs e)
        {
            switch (((RadioButton)sender).Name)
            {
                case "restartButton":
                    this.okButton.DialogResult= DialogResult.Retry;
                    break;
                case "modeButton":
                    this.okButton.DialogResult= DialogResult.Yes;
                    break;
                default:
                    this.okButton.DialogResult= DialogResult.Abort;
                    break;
            }
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
